home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / programming / arexx / easyrexx.lha / EasyREXX / Source / lib.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-02-10  |  709 b   |  41 lines

  1. /*
  2.  *    File:                    libc.
  3.  *    Description:    Linkable library that calls functions in the commandTable.
  4.  *
  5.  *    (C) 1994,1995, Ketil Hunn
  6.  *
  7.  */
  8.  
  9. #include <libraries/easyrexx.h>
  10.  
  11. extern struct Library *EasyRexxBase;
  12.  
  13. LONG HandleARexxFuncs(struct ARexxContext *context)
  14. {
  15.     LONG    result;
  16.  
  17.     if(context)
  18.         if(GetARexxMsg(context))
  19.         {
  20.             register ULONG i=0L;
  21.  
  22.             while(context->table[i].command!=NULL)
  23.             {
  24.                 if(context->table[i].id==context->id)
  25.                 {
  26.                     int (*func)(struct ARexxContext *context);
  27.  
  28.                     if(func=(void *)(context->table[i].userdata))
  29.                         result=func(context);
  30.                     break;
  31.                 }
  32.                 else
  33.                     ++i;
  34.             }
  35.             ReplyARexxMsg(context,
  36.                                         ER_Return, result,
  37.                                         TAG_DONE);
  38.         }
  39.     return result;
  40. }
  41.